package com.hongyu.manager.media.manager.model.result;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.hongyu.manager.media.manager.model.bean.Page;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class Result<T> {
    private boolean success;

    private int code;
    private int errorCode;

    private String msg;

    private String requestId;

    private Long count;

    private Page page;

    private T data;

    public Result() {
    }

    public Result(boolean success, int errcode, String msg) {
        this(success, 0,0, msg, null, null, null);
    }

    public Result(boolean success, int errcode, String msg, long count) {
        this(success, errcode,0, msg, count, null, null);
    }

    public Result(boolean success, int errcode, int code, String msg, long count) {
        this(success, errcode,code, msg, count, null, null);
    }

    public Result(boolean success, int errcode, int code, String msg) {
        this(success, errcode,code, msg, null, null, null);
    }

    public Result(boolean success, int errorCode, int code, String msg, T data) {
        this(success, errorCode,code, msg, null, data, null);
    }

    public Result(boolean success, int errorCode, int code, String msg, Page page) {
        this(success, errorCode,code, msg, null, null, page);
    }
    public Result(boolean success, int code, String msg, T data) {
        this(success, code, msg, null, data, null);
    }
    public Result(boolean success, int errorCode, int code, String msg, Long count, T data, Page page) {
        this.success = success;
        this.code = code;
        this.errorCode=errorCode;
        this.msg = msg;
        this.count = count;
        this.data = data;
        this.page = page;
    }
    public Result(boolean success, int code, String msg, Long count, T data, Page page) {
        this.success = success;
        this.code = code;
        this.msg = msg;
        this.count = count;
        this.data = data;
        this.page = page;
    }
    public boolean isSuccess() {
        return success;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public String getRequestId() {
        return requestId;
    }

    public void setRequestId(String requestId) {
        this.requestId = requestId;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Page getPage() {
        return page;
    }

    public void setPage(Page page) {
        this.page = page;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }

    @Override
    public String toString() {
        return "Result{" +
                "success=" + success +
                ", code=" + code +
                ", errorCode=" + errorCode +
                ", msg='" + msg + '\'' +
                ", requestId='" + requestId + '\'' +
                ", count=" + count +
                ", page=" + page +
                ", data=" + data +
                '}';
    }

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }
}

